home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / faq / comp / unix_faq / shell / shell_di < prev    next >
Internet Message Format  |  1994-04-12  |  16KB

  1. Path: bloom-beacon.mit.edu!news.media.mit.edu!uhog.mit.edu!europa.eng.gtefsd.com!howland.reston.ans.net!pipex!uknet!ukc!gos.ukc.ac.uk!bnb
  2. From: bnb@ukc.ac.uk (B.N.Blackmore)
  3. Newsgroups: comp.unix.shell,comp.unix.questions,news.answers,comp.answers
  4. Subject: UNIX shell differences and how to change your shell (Monthly Posting)
  5. Supersedes: <shell_763742472@ukc.ac.uk>
  6. Followup-To: comp.unix.shell
  7. Date: Tue, 12 Apr 94 08:13:22 GMT
  8. Organization: Univeristy of Kent at Canterbury, England, UK
  9. Lines: 303
  10. Sender: bnb@ukc.ac.uk
  11. Approved: news-answers-request@MIT.Edu
  12. Expires: 24 May 1994 08:13:22 GMT
  13. Message-ID: <9345@gos.ukc.ac.uk>
  14. NNTP-Posting-Host: gos.ukc.ac.uk
  15. Xref: bloom-beacon.mit.edu comp.unix.shell:9595 comp.unix.questions:24411 news.answers:17946 comp.answers:4871
  16.  
  17. Archive-name: unix-faq/shell/shell-differences
  18. Version: 1.05
  19.  
  20. The following article answers the frequently asked questions, what
  21. UNIX shells are available, what are the differences between them and
  22. how do you change your interactive shell. 
  23.  
  24. Contents
  25. ========
  26.  
  27.  o Modifications since last issue 
  28.  o Why change your shell 
  29.  o The history of unix shells 
  30.  o Deciding on a shell 
  31.  o Shell features (table) 
  32.  o How to change your shell 
  33.  o A warning about changing your shell 
  34.  o Further information 
  35.  o Copyright and Disclaimer 
  36.  
  37. Modifications since last issue
  38. ==============================
  39.  
  40.  o Fixed entry for bash under history completion, it does it (M-^) 
  41.  o Added 2 new entries in shell features table for Has
  42.    non-interactive startup file and has non-login startup file. 
  43.  
  44. Why change your shell
  45. =====================
  46.  
  47. The UNIX shell is most people's main access to the UNIX operating
  48. system and as such any improvement to it can result in considerably
  49. more effective use of the system, and may even allow you to do things
  50. you couldn't do before. The primary improvement most of the new
  51. generation shells give you is increased speed. They require a lot less key
  52. strokes to get the same results due to their completion features, they give
  53. you more information e.g. showing your directory in your prompt,
  54. showing which files it would complete, and they cover some of the more
  55. annoying features of UNIX, such as not going back up symbolic links to
  56. directories. 
  57.  
  58. A brief history of UNIX shells
  59. ==============================
  60.  
  61. In the near beginning there was the Bourne shell /bin/sh (written by S. R.
  62. Bourne), it had (and still does) a very strong powerful syntactical
  63. language built into it, with all the features that are commonly considered
  64. to produce structured programs, it has particularly strong provisions for
  65. controlling input and output and in its expression matching facilities. But
  66. no matter how strong its input language is, it had one major drawback; it
  67. made nearly no concessions to the interactive user (the only real
  68. concession being the use of shell functions and these were only added
  69. later) and so there was a gap for something better. 
  70.  
  71. Along came the people from UCB and the C-shell /bin/csh was born.
  72. Into this shell they put several concepts which were new, (the majority of
  73. these being job control and aliasing) and managed to produce a shell that
  74. was much better for interactive use. But as well as improving the shell
  75. for interactive use they also threw out the baby with the bath water and
  76. went for a different input language. 
  77.  
  78. The theory behind the change was fairly good, the new input language
  79. was to resemble C, the language in which UNIX itself was written, but
  80. they made a complete mess of implementing it. Out went the good
  81. control of input and output and in came the bugs. The new shell was
  82. simply too buggy to produce robust shell scripts and so everybody stayed
  83. with the Bourne shell for that, but it was considerably better for
  84. interactive use so changed to the C shell, this resulted in the stupid
  85. situation where people use a different shell for interactive work than for
  86. non-interactive, a situation which a large number of people still find
  87. themselves in today. 
  88.  
  89. After csh was let loose on an unsuspecting world various people decided
  90. that the bugs really should get fixed, and while they where at it they
  91. might as well add some extra features. In came command line editing,
  92. TENEX-style completion and several other features. Out went most of
  93. the bugs, but did the various UNIX operating system manufacturers start
  94. shipping tcsh instead of csh? No, they stuck with the standard C-Shell. 
  95.  
  96. Eventually David Korn from AT&T had the bright idea to sort out this
  97. mess and the Korn shell /bin/ksh made its appearance. This quite sensibly
  98. junked the C shells language and reverted back to the bourne shell
  99. language, but it also added in the many features that made the C shell
  100. good for interactive work (you could say it was the best of both worlds),
  101. on top of this, it also added a some features from other operating. The
  102. Korn shell became part of System V but had one major problem; unlike
  103. the rest of the UNIX shells it wasn't free, you had to pay AT&T for it. 
  104.  
  105. It was at about this time that the first attempts to standardize UNIX
  106. started in the form of the POSIX standard. POSIX specified more or less
  107. the System V Bourne Shell (by this time the BSD and System V versions
  108. had got slightly different). Later the standard is upgraded, and somehow
  109. the new standard managed to look very much like ksh. 
  110.  
  111. Also at about this time the GNU project was underway and they decided
  112. that they needed a free shell, they also decided that they wanted to make
  113. this new shell POSIX compatible, thus bash (the Bourne again shell) was
  114. born. Like the Korn shell bash was based upon the Bourne shells
  115. language and like the Korn shell, it also pinched features from the C
  116. shell and other operating systems (in my opinion it put them together
  117. better; guess which shell I use), but unlike the Korn shell it is free. Bash
  118. was quickly adopted for LINUX (where it can be configured to perform
  119. just like the Bourne shell), and is the most popular of the free new
  120. generation shells. 
  121.  
  122. Meanwhile faced with the problem of porting the Bourne shell to Plan 9,
  123. Tom Duff revolts and writes rc, he publishes a paper on it, and Byron
  124. Rakitzis reimplements it under UNIX. Rc ended up smalled, simpler,
  125. more regular and in most peoples opinion a much better programmed
  126. shell. 
  127.  
  128. The search for the perfect shell still goes on and the latest entry into this
  129. arena is zsh. Zsh was written by Paul Falstad while he was a student a
  130. Princeton and is a feature packed shell which has so many features that I
  131. don't even think the he even knows all of them. 
  132.  
  133. Deciding on a shell
  134. ===================
  135.  
  136. Which of the many shells you choose depends on many different things,
  137. here is what I consider to be the most important, you may think
  138. differently. 
  139.  
  140. How much time do I have to learn a new shell? 
  141.    There is no point in using a shell with a different syntax, or a
  142.    completly different alias system if you havn't the time to learn it.
  143.    If you have the time and are presently using csh or tcsh it is worth
  144.    considering a switch to a Bourne shell variant. 
  145. What do I wish to be able to do with my new shell? 
  146.    The main reason for switching shells is to gain extra
  147.    functionality; its vital you know what you are gaining from the
  148.    switch. 
  149. Do I have to be able to switch back to a different shell? 
  150.    If you may have to switch back to a standard shell, it is fairly
  151.    important you don't become too dependent on extra features and
  152.    so can't use an older shell. 
  153. How much extra load can the system cope with? 
  154.    The more advanced shells tend to take up extra CPU, since they
  155.    work in cbreak mode; if you are on an overloaded machine they
  156.    should probably be avoided; this can also cause problems with an
  157.    overloaded network. This only really applies to very old systems
  158.    nowadays. 
  159. What support is given for my new shell? 
  160.    If your new shell is not supported make sure you have someone
  161.    you can ask if you encounter problems or that you have the time
  162.    to sort them out yourself. 
  163. What shell am I using already? 
  164.    Switching between certain shells of the same syntax is alot easier
  165.    than switching between shells of a different syntax. So if you
  166.    havn't much time a simple upgrade (eg csh to tcsh) may be a good
  167.    idea. 
  168.  minor bugs? 
  169.    Like most software all shells have some bugs in them (especially
  170.    csh), can you afford the problems that may occur because of them.
  171.  
  172. Shell features
  173. ==============
  174.  
  175. This table below lists most features that I think would make you choose
  176. one shell over another. It is not intended to be a definitive list and does 
  177. not include every single possible feature for every single possible shell.
  178. A feature is only considered to be in a shell if in the version that comes
  179. with the operating system, or if it is available as compiled directly from
  180. the standard distribution. 
  181.  
  182.                                         sh   csh   ksh  bash tcsh zsh  rc
  183. Job control                             N    Y     Y    Y    Y    Y    N
  184. Aliases                                 N    Y     Y    Y    Y    Y    N
  185. Shell functions                         Y(1) N     Y    Y    N    Y    Y
  186. "Sensible" Input/Output redirection     Y    N     Y    Y    N    Y    Y
  187. Directory stack                         N    Y     Y    Y    Y    Y    N
  188. Command history                         N    Y     Y    Y    Y    Y    N(7)
  189. Command line editing                    N    N     Y    Y    Y    Y    N(7)
  190. Vi Command line editing                 N    N     Y    Y    Y(3) Y    N(7)
  191. Emacs Command line editing              N    N     Y    Y    Y    Y    N(7)
  192. Rebindable Command line editing         N    N     N    Y    Y    Y    N(7)
  193. User name look up                       N    Y     Y    Y    Y    Y    N(7)
  194. Login/Logout watching                   N    N     N    N    Y    Y    N
  195. Filename completion                     N    Y(1)  Y    Y    Y    Y    N(7)
  196. Username completion                     N    Y(2)  Y    Y    Y    Y    N(7)
  197. Hostname completion                     N    Y(2)  Y    Y    Y    Y    N(7)
  198. History completion                      N    N     N    Y    Y    Y    N(7)
  199. Fully programmable Completion           N    N     N    N    Y    Y    N
  200. Mh Mailbox completion                   N    N     N    N(4) N(6) N(6) N
  201. Co Processes                            N    N     Y    N    N    Y    N
  202. Builtin artithmetic evaluation          N    Y     Y    Y    Y    Y    N
  203. Can follow symbolic links               N    N     Y    Y    Y    Y    N
  204. Periodic command execution              N    N     N    N    Y    Y    N
  205. Custom Prompt (easily)                  N    N     Y    Y    Y    Y    Y
  206. Sun Keyboard Hack                       N    N     N    N    N    Y    N
  207. Spelling Correction                     N    N     N    N    Y    Y    N
  208. Process Substitution                    N    N     N    Y(2) N    Y    Y
  209. Underlying Syntax                       sh   csh   sh   sh   csh  sh   rc
  210. Freely Available                        N    N     N(5) Y    Y    Y    Y
  211. Checks Mailbox                          N    Y     Y    Y    Y    Y    N(8)
  212. Tty Sanity Checking                     N    N     N    N    Y    Y    N
  213. Can cope with large argument lists      Y    N     Y    Y    Y    Y    Y
  214. Has non-interactive startup file        N    Y     Y(9) Y(9) Y    Y    N
  215. Has non-login startup file              N    Y     Y(9) Y    Y    Y    N
  216. Can avoid user startup files            N    N     N    Y    N    Y    Y
  217. Can specify startup file                N    N     Y    Y    N    N    N
  218.  
  219. Notes to the table above 
  220.  
  221.  1. This feature was not in the orginal version, but has since become
  222.    almost standard. 
  223.  2. This feature is fairly new and so is often not found on many
  224.    versions of the shell, it is gradually making its way into standard
  225.    distribution. 
  226.  3. The Vi emulation of this shell is thought by many to be
  227.    incomplete. 
  228.  4. This feature is not standard but unoffical patches exist to perform
  229.    this. 
  230.  5. A version called 'pdksh' is freely available, but does not have the
  231.    full functionality of the AT&T version. 
  232.  6. This can be done via the shells programmable completion
  233.    mechanism. 
  234.  7. A library can be linked into the shell to provide this feature. 
  235.  8. This can be done via the shells prompt function. 
  236.  9. Only by specifing a file via the ENV environment variable. 
  237.  
  238. How to change your shell
  239. ========================
  240.  
  241. If you ever look at a UNIX manual page it will say that to change your
  242. shell use chsh or passwd -s; unfortunately it often isn't as simple as this,
  243. since it requires that your new shell is recognized as a valid shell by the
  244. system and at present many systems do not recognize the newer shells
  245. (the normal selection is, /bin/sh, /bin/csh and possibly /bin/ksh). You are
  246. thus left with having to do some sort of fudge, changing your effective
  247. login shell without changing your official entry in /etc/passwd. You may
  248. also be left with the problem that there isn't a compiled binary on your
  249. system , so you will have to get hold of the shell's source and compile it
  250. yourself (Its generally best to ask around to see if anyones done this
  251. already, since it isn't that easy). Once done you should add in code to
  252. your old shells login file so that it overlays your official login shell with
  253. your new shell (remember to add the login flags to the command line,
  254. and with csh/tcsh ensure that the overlay doesn't happen recursively since
  255. they both read the same .login file). 
  256.  
  257. The shell can be recognized as a valid shell if the system administrator
  258. puts it in the file /etc/shells. If this file does not exist, it must be created
  259. and should contain all valid shells (i.e.don't forget the traditional ones in
  260. all their forms). 
  261.  
  262. WARNING
  263. =======
  264.  
  265. If you do decide to change your shell you must be very careful - if
  266. handled wrongly it can be almost impossible to correct, and will almost
  267. certainly cause you a lot of hassle. Never make a new shell a login shell
  268. until you have tested its new configuration files thoroughly and then
  269. tested them once again. It is also important that you make a full backup
  270. of your previous config files onto a floppy disk (or a different host if you
  271. have a second account) if you have to change any of them (which you
  272. will probably have to do if you can't change your shell entry in 
  273. /etc/passwd). You should also note that your new shell is probably not
  274. supported by your system admin, so if you have any problems you will
  275. probably have to look elsewhere. 
  276.  
  277. Further information
  278. ===================
  279.  
  280. The Bourne shell, the C-Shell and the Korn Shell (if you have it) are all
  281. distributed as standard with your UNIX operating system, information
  282. on these should come with your operating system, bug reports etc should
  283. be sent to your operating system vendor. 
  284.  
  285. Bash was written and is maintained by the Free Software Foundation, the
  286. primary source of information for this shell is its manual page. Bug
  287. reports should be sent to bash-maintainers@ai.MIT.Edu, while
  288. suggestions and philosophical bug reports may be mailed to 
  289. bug-bash@ai.MIT.Edu or posted to the Usenet newsgroup gnu.bash.bug,
  290. the source is widely available on many ftp sites, and is subject to the
  291. GNU copyleft licence. 
  292.  
  293. Rc is available by ftp from ftp:viz.tamu.edu/pub/rc and several other
  294. places. An FAQ exists and is posted frequently to comp.unix.shell and
  295. other places. The Rc mailing list may be subscribed to by sending mail to
  296. rc-request@hawkwind.utcs.toronto.edu, this, the manual page and the Rc
  297. FAQ are the main sources of information for this shell. 
  298.  
  299. Zsh is now maintained by the zsh mailing list, which can be subscribed to
  300. by sending email to Majordomo@sterling.com containing subscribe
  301. zsh-list, there is also an FAQ which is posted frequently to
  302. comp.unix.shell. The manual page, the Z-shell FAQ and the zsh-list are
  303. the main sources of information for this shell. 
  304.  
  305. Questions on any of the UNIX shells and on shell script programming,
  306. may be posted to the Usenet newsgroup comp.unix.shell a quick response
  307. can normally be expected, especially on subjects relating to the more
  308. common shells. 
  309.  
  310. Copyright and Disclaimer
  311. ========================
  312.  
  313. Copyright to this document is kept by the author, but freedom is given to
  314. distribute it as long as no money is made from its distribution, without
  315. prior concent of the author. The author also does not guarantee that the
  316. information it contains is correct, although every effort is done to ensure
  317. that it is. 
  318.  
  319. of Kent at Canterbury, bnb@ukc.ac.uk 
  320.